package com.pktechan.api.enumeration;

/**
 * 订单类型枚举
 * 11-vip复购 12-配送商复购  21-注册VIP 22-注册配送商
 */
public enum OrderTypeEnum {

    REPURCHASE(10, "游客复购"),
    VIP_REPURCHASE(11, "会员复购"),
    DISTRIBUTION_REPURCHASE(12, "配送商复购"),
    REGISTER_VIP(21, "注册会员"),
    REGISTER_DISTRIBUTOR(22, "注册配送商");

    private Integer code;
    private String name;

    OrderTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(Integer code) {
        for (OrderTypeEnum orderTypeEnum : OrderTypeEnum.values()) {
            if (orderTypeEnum.code.equals(code)) {
                return orderTypeEnum.name;
            }
        }
        return null;
    }
}
